xend: fix setting vcpus > VCPUs_max
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 20 Oct 2008 14:17:24 +0000 (15:17 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 20 Oct 2008 14:17:24 +0000 (15:17 +0100)
commit81d08745ba299347f3ed42371c514eb14aa2f409
tree52c19373c99f45c9e9d1dbab5af931088124a5ec
parent39bd20538e458cd6627eafa40a6378361b464304
xend: fix setting vcpus > VCPUs_max

From reading xend code related to changing number of vcpus it appears
setting the number of vcpus to a value greater than VCPUs_max is not
allowed on a running domain.  This restriction is not honored by
setVCpuCount() in XendDomainInfo.py.  Attached patch makes
setVCpuCount() fail if vcpus > VCPUs_max and domain is running.

Also, I think the changes should be reflected in managed config of
running domain if in fact the domain is managed - so unconditionally
call managed_config_save().

BTW, the original code is rather confusing.  Essentially the same
actions are taken regardless if self.info['VCPUs_max'] > vcpus, just
the order of invocation is changed.  But this doesn't seem to matter
since self.info['VCPUs_live'] is not subsequently used.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
tools/python/xen/xend/XendDomainInfo.py